<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateBalanceTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        //
        Schema::create('el_balance', function (Blueprint $table) {
            $table->increments('id');

            $table->integer('user_id')->unsigned();

           $table->integer('type')->nullable();

            //information of balance 's variation
            $table->string('note')->nullable();

            //value of alteration, it can be negative or positive
            $table->integer('value');

            // where is the action happened
            $table->integer('origin_id')->nullable();
            $table->string('origin_type')->nullable();

            $table->timestamps();

            $table->softDeletes();

            $table->engine = 'InnoDB';

        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        //
        Schema::dropIfExists('el_balance');
    }
}
